﻿var $bsTableSignUp = $("#bsTableSignUp");
var $bsTableJudges = $("#bsTableJudges");
$(function () {
    //签到-报名商家列表
    $bsTableSignUp.bootstrapTable({
        url: "/SignUpInfo/GetList",
        pagination: true,
        pageSize: 10,
        singleSelect: true,//复选框只能选中一个
        clickToSelect: true,//单击行勾选复选框
        queryParams: queryParams
    });

    //评委专家列表
    $bsTableJudges.bootstrapTable({
        url: "/Judges/GetList",
        pagination: false,
        singleSelect: true,//复选框只能选中一个
        clickToSelect: true,//单击行勾选复选框
        queryParams: queryParams
    });

    //添加评委专家
    $("#addJudges").click(function () {
        showJudges("/Judges/Create?projectId=" + ProjectInfoId, '添加');
    });

});

function queryParams(params) {
    return {
        PageIndex: params.offset / params.limit + 1,
        PageSize: params.limit,
        Key: "",
        projectId: ProjectInfoId
    };
}

function SearchSignUp() {
    $bsTableSignUp.bootstrapTable("refreshOptions", {
        pageNumber: 1,
        queryParams: queryParams
    });
}

function SearchJudges() {
    $bsTableJudges.bootstrapTable("refreshOptions", {
        pageNumber: 1,
        queryParams: queryParams
    });
}

//签到按钮
function signFormatter(value, row, index) {
    return '<a href="javascript:void(0);" onclick="showSignIn(\'/SignUpInfo/SignIn/' + value + '\')" class="btn btn-xs blue"><i class="fa fa-bars"></i> 签到</a>' +
        '<a href="/SignUpInfo/SignInReceipt?index=' + (index + 1) + '&sid=' + row.Id+'"  target="_blank" class="btn btn-xs green"><i class="fa fa-print"></i> 签收回执</a>';
}

//评审专家按钮
function editJudgesFormatter(value, row, index) {
    return '<a href="javascript:void(0);" onclick="showJudges(\'/Judges/Edit/' + value + '\',\''+修改+'\')" class="btn btn-xs blue"><i class="fa fa-edit"></i> 修改</a>';
}

function indexFormatter(value, row, index) {
    return (index + 1);
}

//打开签到页面
function showSignIn(url) {
    layer.open({
        type: 2,
        title: "签到",
        area: ["500px", "378px"],
        content: [url, 'no']
    });
}

//打开评审专家页面
function showJudges(url, title) {
    layer.open({
        type: 2,
        title: title +"评审专家",
        area: ["500px", "300px"],
        content: [url, 'no']
    });
}


